package org.example.repository;

import java.util.List;

public interface Repository<T extends Entity<?>> {
    default List<T> find() {
        return find(Query.Empty);
    }

    List<T> find(Query query);

    default long count() {
        return count(Query.Empty);
    }

    long count(Query query);

    T findById(Object id);

    default T findFirst() {
        return findFirst(Query.Empty);
    }

    T findFirst(Query query);

    int add(T entity);

    int update(T entity, Condition where);

    void clear();
}
